<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>js_for循环练习</title>
    <style>
        div{
            width: 50px;
            height: 50px;
            background-color: red;
            text-align: center;
            line-height: 50px;
            color: #fff;
            position: absolute;
            top: 0px;
            left: 0px;
        }
    </style>
    <script >
        window.onload=function(){
            var aDiv = document.getElementsByTagName('div');
            var temp="";
            for(var i=0;i<10000;i++){
                temp+="<div>"+i+"</div>"
            }
            document.body.innerHTML=temp;
            for(var i = 0;i<aDiv.length;i++){
                aDiv[i].style.left = (i%10)*60 + "px";
                aDiv[i].style.top = parseInt(i/10)*60 + "px";
            }
        }
    </script>
</head>
<body>
</body>
</html>